package com.sunday.scoremanager.http;

import com.sunday.common.model.ResultDO;
import com.sunday.common.model.Version;
import com.sunday.scoremanager.entity.Bank;
import com.sunday.scoremanager.entity.BankAccount;
import com.sunday.scoremanager.entity.CashRecord;
import com.sunday.scoremanager.entity.Comment;
import com.sunday.scoremanager.entity.FanEntity;
import com.sunday.scoremanager.entity.Fans;
import com.sunday.scoremanager.entity.Income;
import com.sunday.scoremanager.entity.Member;
import com.sunday.scoremanager.entity.Message;
import com.sunday.scoremanager.entity.Order;
import com.sunday.scoremanager.entity.Product;
import com.sunday.scoremanager.entity.RecordDetail;
import com.sunday.scoremanager.entity.ShopQrCode;
import com.sunday.scoremanager.entity.StaffAccount;
import com.sunday.scoremanager.entity.UpLoadImg;

import java.util.List;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Query;

/**
 * Created by 刘涛 on 2017/10/17.
 */

public interface ApiService {


    /**
     * 发送验证码
     * 验证码类型 1注册 2修改密码 3忘记密码 4,绑定银行卡 5添加会员 其他的各个项目自己定义
     */
    @FormUrlEncoded
    @POST("/mobile/validCode/sendValidCode")
    Call<ResultDO> sendCode(@Field("mobile") String mobile, @Field("smsFreeSignName")String smsFreeSignName,
                            @Field("templateCode") String templateCode, @Field("type") int type);




    /**
     *
     *
     */
    @FormUrlEncoded
    @POST("/mobile/shop/getRelationShop")
    Call<ResultDO<List<Member>>> getRelationShop(@Field("sellerId") long sellerId);


    /**
     * boss登录
     *
     */
    @FormUrlEncoded
    @POST("/mobile/account/bossLogin")
    Call<ResultDO<List<Member>>> bossLogin(@Field("mobile") String mobile, @Field("code")String code);



    /**
     * 员工登录
     *
     */
    @FormUrlEncoded
    @POST("/mobile/account/childLogin")
    Call<ResultDO<Member>> childLogin(@Field("account") String account, @Field("pwd")String pwd);

    /**
     * 多张图片上传
     */
    @Multipart
    @POST("/mobile/commons/multiImages")
    Call<ResultDO<List<UpLoadImg>>> uploadImgs(@Part("images") RequestBody body);

    /**
     * 单张图片上传
     */
    @Multipart
    @POST("/mobile/commons/singleImage")
    Call<ResultDO<UpLoadImg>> singleImage(@Part("image") RequestBody body);


    /**
     * 添加产品
     *
     */
    @FormUrlEncoded
    @POST("/mobile/shop/addProduct")
    Call<ResultDO<Product>> addProduct(@Field("productId") Long productId, @Field("sellerId")long sellerId,
                                       @Field("productName")String productName,@Field("productMarketPrice")String productMarketPrice,
                                       @Field("productPrice")String productPrice, @Field("productDesc")String productDesc,
                                       @Field("isRec")Integer isRec,@Field("image")String image,@Field("images")String images,
                                       @Field("commissionScale")Integer commissionScale);

    /**
     * 订单列表
     *
     */
    @FormUrlEncoded
    @POST("/mobile/order/orderList")
    Call<ResultDO<List<Order>>> getOrderList(@Field("memberId") long memberId, @Field("memberType")int memberType,
                                           @Field("pageNo")int pageNo, @Field("pageSize")int pageSize);

    /**
     * 添加会员
     *
     */
    @FormUrlEncoded
    @POST("/mobile/shop/addShopMember")
    Call<ResultDO> addShopMember(@Field("sellerId") long sellerId, @Field("mobile")String mobile,
                                             @Field("code")String code);

    /**
     * 消费积分/怀亚积分/积分收入/卡券余额/商家营收
     *type 1-消费积分 2-怀亚积分 3-积分收入 4-卡券余额 5-商家营收
     * memberType 1-用户 2-商家
     */
    @FormUrlEncoded
    @POST("/mobile/member/myAssets")
    Call<ResultDO<Income>> myAssets(@Field("memberId") long memberId, @Field("type")int type,
                                         @Field("memberType")int memberType);

    /**
     *
     *各种收益记录
     *type 1-消费积分 2-怀亚积分 3-积分收入 4-通用券余额
     *memberType 1-用户 2-商家
     */
    @FormUrlEncoded
    @POST("/mobile/member/recordDetail")
    Call<ResultDO<List<RecordDetail>>> recordDetail(@Field("memberId") long memberId, @Field("type")int type,
                                                @Field("memberType")int memberType,@Field("pageNo")int pageNo,
                                                    @Field("pageSize")int pageSize,@Field("date")String date);



    /**
     *二维码
     *
     */
    @FormUrlEncoded
    @POST("/mobile/shop/sellerTwoCode")
    Call<ResultDO<ShopQrCode>> sellerTowCode(@Field("sellerId") long sellerId);

    /**
     *
     *我的
     *memberType 1-用户 2-商家
     * @param tag 1-钻石会员 2-黄金会员
     */
    @FormUrlEncoded
    @POST("/mobile/member/myMember")
    Call<ResultDO<FanEntity>> getMyMember(@Field("memberType") int memberType, @Field("memberId")long memberId,
                                          @Field("tag")int tag, @Field("pageNo")int pageNo, @Field("pageSize")int pageSize);


    /**
     *
     *搜索会员
     *
     */
    @FormUrlEncoded
    @POST("/mobile/shop/findMember")
    Call<ResultDO<Fans>> findMember(@Field("mobile") String mobile);

    /**
     *
     *产品列表
     *
     */
    @FormUrlEncoded
    @POST("/mobile/shop/productList")
    Call<ResultDO<List<Product>>> getProductList(@Field("sellerId") long sellerId,@Field("status")int status,
                                                 @Field("pageNo")int pageNo,@Field("pageSize")int pageSize);


    /**
     *
     *修改产品状态
     *@param status 1上架 2下架 3 删除
     */
    @FormUrlEncoded
    @POST("/mobile/shop/updateProductStatus")
    Call<ResultDO> updateProductStatus(@Field("productId") long productId,@Field("status")int status);


    /**
     *
     *评论列表
     *@param
     */
    @FormUrlEncoded
    @POST("/mobile/shop/commentList")
    Call<ResultDO<List<Comment>>> commentList(@Field("sellerId") long sellerId, @Field("pageNo")int pageNo,
                                              @Field("pageSize")int pageSize);

    /**
     *
     *评论列表
     *@param
     */
    @FormUrlEncoded
    @POST("/mobile/shop/replayComment")
    Call<ResultDO> replayComment(@Field("commentId") long commentId, @Field("replyId")long replyId,
                                              @Field("content")String content);

    /**
     *
     *子账号列表
     *@param
     */
    @FormUrlEncoded
    @POST("/mobile/account/accountList")
    Call<ResultDO<List<StaffAccount>>> accountList(@Field("sellerId") long sellerId);


    /**
     *
     *子账号
     *@param
     */
    @FormUrlEncoded
    @POST("/mobile/account/deleteAccount")
    Call<ResultDO> deleteAccount(@Field("accountId") long accountId);

    /**
     *
     *添加子账号
     *@param
     */
    @FormUrlEncoded
    @POST("/mobile/account/addAccount")
    Call<ResultDO> addAccount(@Field("sellerId")long sellerId,@Field("account") String account,
                              @Field("pwd")String pwd);

    /**
     *
     *
     *@param
     */
    @FormUrlEncoded
    @POST("/mobile/account/updateAccount")
    Call<ResultDO> updateAccount(@Field("accountId")long accountId, @Field("pwd")String pwd);

    /**
     *
     *
     * @param
     * @param
     * @return
     */
    @GET("/mobile/cash/getMemberCardList")
    Call<ResultDO<List<BankAccount>>> getMemberBank(@Query("memberId") long memberId,@Query("memberType")int memberType);

    /**
     *
     *
     * @param
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/mobile/cash/save")
    Call<ResultDO> saveBankAccount(@Field("bankId") Long bankId, @Field("memberId") long memberId,@Field("cardNo")String cardNo,
                                   @Field("name")String name,@Field("idCard")String idCard,@Field("mobile")String mobile,
                                   @Field("memberType")int memberType);

    /**
     *
     *
     * @param
     * @param
     * @return
     */
    @GET("/mobile/cash/getBankList")
    Call<ResultDO<List<Bank>>> getBankList();

    /**
     *
     *
     * @param
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/mobile/cash/deleteCard")
    Call<ResultDO> deleteCard(@Field("id") long id);


    /**
     *
     * 设置交易密码
     * @param memberType 1普通用户 2-商家
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/mobile/member/setTradePwd")
    Call<ResultDO<Member>> setTradePwd(@Field("memberType") int memberType,@Field("memberId")long memberId,@Field("tradePwd")String tradePwd,
                                       @Field("validateCode")String validateCode);

    /**
     *
     *
     * @param
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/mobile/cash/makeCash")
    Call<ResultDO> makeCash(@Field("memberId") long memberId,@Field("cardId")long cardId,@Field("amount")String amount,
                            @Field("tradePwd")String tradePwd,@Field("type")int type,@Field("memberType")int memberType,
                            @Field("cashType")int cashType);


    /**
     * @param  memberType 用户类型 1-普通用户 2-商家
     * @param  cashType  提现类型 1-消费积分分红提现 2-怀亚积分分红提现 3-商家营收提现
     * @param
     * @return
     */
    @FormUrlEncoded
    @POST("/mobile/cash/cashRecord")
    Call<ResultDO<List<CashRecord>>> cashRecord(@Field("memberId") long memberId, @Field("memberType")int memberType,
                                                @Field("cashType")int cashType, @Field("pageNo")int pageNo, @Field("pageSize")int pageSize);



    /**
     *
     *
     *@param
     */
    @FormUrlEncoded
    @POST("/mobile/shop/updateSellerInfo")
    Call<ResultDO<Member>> updateMember(@Field("sellerId") long memberId, @Field("logo")String logo,
                                        @Field("name")String name);


    /**
     *
     * @param appCode user用户 manage管理版
     * @param versionCode
     * @return
     */
    @FormUrlEncoded
    @POST("/mobile/version/getApkInfo")
    Call<ResultDO<Version>> checkVersion(@Field("appCode") String appCode, @Field("versionCode") int versionCode);


    /**
     * 推送 登录保存tokend
     */
    @FormUrlEncoded
    @POST("/mobile/commons/uploadToken")
    Call<ResultDO> upLoadClientId(@Field("memberId")long memberId,@Field("deviceToken")String token,@Field("deviceType")int deviceType,
                                  @Field("type")int type);

    /**
     *
     */
    @FormUrlEncoded
    @POST("/mobile/commons/getMessageList")
    Call<ResultDO<List<Message>>> getMessageList(@Field("memberId")long memberId, @Field("pageNo")int pageNo, @Field("pageSize")int pageSize,
                                                 @Field("msgType")int msgType);

    /**
     *
     */
    @FormUrlEncoded
    @POST("/mobile/commons/getRecent")
    Call<ResultDO<List<Message>>> getRecentMsg(@Field("memberId")long memberId);

    /**
     * 修改密码
     */
    @FormUrlEncoded
    @POST("/mobile/member/findPwd")
    Call<ResultDO> findPwd(@Field("mobile") String mobile, @Field("validateCode") String validateCode, @Field("password") String password);



}
